export default function (rules, form) {
	let isPass = true;
	for (let key in rules) {
		for (let i = 0; i < rules[key].length; i++) {
			const item = rules[key][i];
			// 判断是否必填
			if (item.require && (form[key] === '' || form[key] === null || form[key] === undefined || form[key].length === 0)) {
				isPass = false;
			}
			// 判断最小位数
			if (item.min && form[key] !== '' && form[key].length < item.min) {
				isPass = false;
			}
			// 判断是否有正则
			if (item.validator && item.validator(form[key])) {
				isPass = false;
			}
			if (!isPass) {
				uni.showToast({
					title: item.msg,
					icon: 'none'
				});
				break;
			}
		}
		if (!isPass) {
			break;
		}
	}
	return isPass;
}